In image compression methods such as Motion Picture Experts Group (MPEG)-1, MPEG-2, MPEG-4 and H.264/MPEG-4 Advanced Video Coding (AVC), one picture is divided into macroblocks to encode an image. Then, the respective macroblocks are encoded using inter prediction or intra prediction.
In intra prediction, a current block of a current picture is encoded not using a reference picture, but using values of pixels spatially adjacent to the current block. An intra prediction mode with little distortion is selected by comparing a prediction block generated using the adjacent pixel values with an original macroblock. Then, using the selected intra prediction mode and the adjacent pixel values, prediction values of the current block are calculated. Difference between the prediction values and pixels values of the original current block are calculated and then encoded through transform coding, quantization and entropy coding. The intra prediction mode is also encoded.
Intra prediction are generally classified into 4×4 intra prediction, 8×8 intra prediction and 16×16 intra prediction for luminance components and chrominance components.
In 16×16 intra prediction according to related art, there are four modes of a vertical mode, a horizontal mode, a direct current (DC) mode and a plane mode.
In 4×4 intra prediction according to related art, there are nine modes of a vertical mode, a horizontal mode, a DC mode, a diagonal down-left mode, a diagonal down-right mode, a vertical right mode, a vertical left mode, a horizontal-up mode and a horizontal-down mode.
Each prediction mode has indexed according to the frequency of use of the respective modes. The vertical mode that is mode 0 shows the highest possibility of being used most frequently for performing intra prediction on a target block, and the horizontal-up mode that is mode 8 shows the highest possibility of being used most infrequently.
According to H.264 standards, a current block is encoded using a total of 13 modes, that is, 4 modes of the 4×4 intra prediction and 9 modes of the 16×16 intra prediction. A bit stream of the current block is generated according to an optimal mode among these modes.
However, when some or all values of pixels adjacent to current block do not exist or are not already encoded, it is impossible to apply some or all of the intra prediction modes to the current block. Also, when a difference between adjacent reference pixels is large, a difference between a prediction block and an original block becomes large. Therefore, new technique is required to reduce the difference between an original block and a prediction block generated based on positions of reference pixels used for generating the prediction block.